package kuang;

/**
 * @author cyt
 * @create 2020-03-07 14:32
 */
public class ThreadState {

    public static void main(String[] args) {

        Thread thread = new Thread(() -> {
            System.out.println("Thread is run");
        });

        Thread.State state = thread.getState();

        System.out.println(state);
        thread.start();


        state = thread.getState();
        System.out.println(state);
        while (thread.getState() != Thread.State.TERMINATED) {
            try {
                Thread.sleep(100);
            } catch (Exception e) {
                e.printStackTrace();
            }
            state = thread.getState();
            System.out.println(state);
        }
    }
}
